cmake_minimum_required(VERSION 3.0.2)
project(astar)

## C++11
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-conversion-null")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pointer-arith")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
if (COMPILER_SUPPORTS_CXX11)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
elseif (COMPILER_SUPPORTS_CXX0X)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else ()
    message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif ()

find_package(catkin REQUIRED COMPONENTS
        roscpp
        rospy
        std_msgs
        nav_msgs
        sensor_msgs
        genmsg
        message_generation
        nav_core
        tf
        rosbag
        )


set(SOURCES
        ${CMAKE_CURRENT_SOURCE_DIR}/src/astar.cpp
        )

set(HEADERS
        ${CMAKE_CURRENT_SOURCE_DIR}/include/astar/constants.h
        ${CMAKE_CURRENT_SOURCE_DIR}/include/astar/astar.h
        )

# Declare a catkin package
catkin_package(
        CATKIN_DEPENDS roscpp rospy message_runtime
)

include_directories(
        include/astar
        ${catkin_INCLUDE_DIRS}
        ${Boost_INCLUDE_DIRS}
)


# Hybrid A* Header and Source files
add_executable(astar src/astar.cpp ${SOURCES} ${HEADERS})
add_dependencies(astar ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(astar ${catkin_LIBRARIES})
catkin_install_python(PROGRAMS DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
